package com.bbzn.user.client.vo;

import com.bbzn.user.client.enums.ResultCode;
import com.bbzn.user.client.utils.BaseResponse;
import lombok.Data;

/**
 * Created by 廖师兄
 * 2017-12-10 18:02
 */
@Data
public class ResultVO<T> {
    /**
     * 状态码，比如1000代表响应成功
     */
    private int code;
    /**
     * 响应信息，用来说明响应情况
     */
    private String msg;
    /**
     * 响应的具体数据
     */
    private T data;

    public ResultVO(T data) {
        this(ResultCode.SUCCESS,data);
    }

    public ResultVO(ResultCode resultCode, T data) {
        this.code = resultCode.getCode();
        this.msg = resultCode.getMessage();
        this.data = data;
    }

    public ResultVO(ResultCode resultCode) {
        this.code = resultCode.getCode();
        this.msg = resultCode.getMessage();
    }

    public ResultVO(BaseResponse baseResponse) {
        this.code = baseResponse.getCode();
        this.msg = baseResponse.getMsg();
    }
}
